/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB3D_PARTICLEEVENT_H__
#define __LIB3D_PARTICLEEVENT_H__

#include "Particle.h"
#include <sys/types.h>
#include <Atom.h>
#include "ParticleKeyFrame.h"
#include <xml/Object.h>

namespace liba
{
	namespace lib3d
	{
		namespace particles
		{
			class ParticleEvent : public xml::ObjectANSI
			{
			private:
				int _referencesCounter;
			protected:
				virtual ~ParticleEvent() {}
			public:
				ParticleEvent() : _referencesCounter(1)
				{
				}
				virtual void update_particle(Particle * particle, Float delta_time, KeyFrameIterator base_frame, KeyFrameIterator next_frame, KeyFrameArray * frames) = 0;
				virtual Atom get_type() = 0;
				virtual Float get_time() = 0;
				virtual ParticleEvent * retain()
				{
					++_referencesCounter;
					
					return this;
				}
				virtual void release()
				{
					if(--_referencesCounter == 0)
						delete this;
				}
			};
		}
	}
}

using namespace liba;

#endif